/**
 * old
 * import "@babel/polyfill";
 *
 * @babel/polyfill 已经被明确的声明弃用 这里按照官网的教程使用以下两个配置实现兼容
 * https://babeljs.io/docs/en/babel-polyfill
 */
// import './public-path'
import "core-js/stable";
import "regenerator-runtime/runtime";

import Vue from "vue";

import "normalize.css/normalize.css"; // a modern alternative to CSS resets
import Element from "element-ui";
import "./styles/element-variables.scss";
import "../node_modules/element-ui/packages/theme-chalk/src/index.scss";

import "@/styles/index.scss"; // global css
import "@/styles/gd-city.scss"; // global css

import App from "./App";
import store from "./store";
import router from "./router";

import i18n from "./lang"; // internationalization
import "./icons"; // icon
import "./utils/error-log"; // error log
import request from "@/utils/request";
import "./utils/lib-flexible";

import * as filters from "./filters"; // global filters
import {
  hasPermission,
  hasNoPermission,
  hasAnyPermission,
} from "./utils/permissionDirect";
import commonJs from "../src/assets/js/common";

const Plugins = [hasPermission, hasNoPermission, hasAnyPermission];

Plugins.map((plugin) => {
  Vue.use(plugin);
});

Vue.use(Element, {
  i18n: (key, value) => i18n.t(key, value),
});

Vue.prototype.$post = request.post;
Vue.prototype.$get = request.get;
Vue.prototype.$put = request.put;
Vue.prototype.$delete = request.delete;
Vue.prototype.$download = request.download;
Vue.prototype.$upload = request.upload;
Vue.prototype.$login = request.login;

import dayjs from "dayjs"
Vue.prototype.$dayjs = dayjs

// 富文本编辑器
import tinymce from 'tinymce';
Vue.prototype.$tinymce = tinymce;


// register global utility filters
Object.keys(filters).forEach((key) => {
  Vue.filter(key, filters[key]);
});

Vue.config.productionTip = false;

// 事件总线
Vue.prototype.eventBus = new Vue();

// 引入公共js
Vue.prototype.$commonJs = commonJs;

const vue = new Vue({
  el: "#app-ygf",
  router,
  store,
  i18n,
  render: (h) => h(App),
});

export default vue;
